package com.mini.grpc.client.netty;

import com.mini.grpc.client.ManagedChannel;
import com.mini.grpc.client.ManagedChannelBuilder;

import java.net.SocketAddress;

/**
 * NettyChannelBuilder是基于Netty的通道构建器。
 */
public class NettyChannelBuilder extends ManagedChannelBuilder<NettyChannelBuilder> {
    
    private final SocketAddress address;
    
    /**
     * 创建一个新的NettyChannelBuilder
     *
     * @param address 服务端地址
     */
    public NettyChannelBuilder(SocketAddress address) {
        this.address = address;
    }
    
    @Override
    protected NettyChannelBuilder thisT() {
        return this;
    }
    
    @Override
    public ManagedChannel build() {
        return new NettyChannel(address, !isUsePlaintext());
    }
} 